import axios from 'axios';
var instance = axios.create({
    baseURL: 'http://localhost:8080/api/',
    timeout: 1000
});
export const $setToken=(token)=>{
    instance.defaults.headers.common['token']=token;
}

export const $get = async(url, param) => {
    let { data } = await instance.get(url, {
        param
    });

    return data;
}
export const $post = async(url, param) => {
    let { data } = await instance.post(url, param);
    return data;
}
export const $put = async(url, param) => {
    let { data } = await instance.put(url, param);
    return data;
}
export const $del = async(url, param) => {
    let { data } = await instance.del(url, {
        param
    });
    return data;
}